from flask import Blueprint, request, abort, url_for, session

# 创建蓝图对象
from info.models import User

admin_blu = Blueprint('admin', __name__)

from . import views


@admin_blu.before_request
def before_request():
    # 判断是否是管理员，不是不能访问
    is_admin = session.get('is_admin', False)
    if not is_admin and not request.url.endswith(url_for('admin.login')):
        abort(404)